
import {Component, OnInit} from "@angular/core";
import {Project} from "../entity/Project";
import {ProjectFindService} from "../service/project.find.service";
import {Router} from "@angular/router";
@Component({
  selector:"project-ranking",
  templateUrl:"./project-index-ranking.html",
  styleUrls: ['./project-index-ranking.css']})
export class ProjectIndexRankingComponent
implements OnInit
{
  public rankProjects:Array<Project>;

  constructor(private projectService: ProjectFindService,
  private router: Router) { }

  ngOnInit(): void {
    this.getProjectRankingList("1");
  }
  public toProjectIndex(id:string){

    this.router.navigate(['/project/index/',id]);
  }
  private getProjectRankingList(siteId: string) {
    this.projectService.getRankingProjectList(siteId)
      .then(projects => this.rankProjects = projects);
  }
}
